<script setup>
import { onMounted, ref } from 'vue';
import useDataStore from '@/store';
import { storeToRefs } from 'pinia';
import { dayjs } from 'element-plus';
defineOptions({
    name: 'mobilePreview'
})

const dataStore = useDataStore()
const { userInfo } = storeToRefs(dataStore)

const props = defineProps({
    title: {
        type: String,
        default: ''
    },
    intro: {
        type: String,
        default: ''
    },
    imageUrl: {
        type: String,
        default: ''
    },
    valueHtml: {
        type: String,
        default: ''
    },
    articlePhotoList: {
        type: Array,
        default: () => []
    }
})


</script>

<template>
    <div class="preview-main">
        <div class="main-left">
            <!-- <div class="left-bread">
                <div class="bread-link">
                    移动端效果预览
                </div>
            </div> -->
            <div class="left-main">
                <div class="left-title">{{ title }}</div>
                <div class="left-author">
                    <div>{{ userInfo?.user_name }}</div>
                    <div>{{ dayjs().format("YYYY-MM-DD") }}</div>
                </div>
                <div class="left-intro">{{ intro }}</div>
                <div class="left-photos">
                    <el-carousel>
                        <el-carousel-item v-for="item in articlePhotoList" :key="item">
                            <img class="left-photos-img" :src="item.url" alt="">
                        </el-carousel-item>
                    </el-carousel>
                </div>
                <div class="left-content" v-html="valueHtml"></div>
                <div class="left-btns">
                    <div class="btn" :class="{ likeSelected: true }"><i class="iconfont icon-dianzan_kuai"></i>点赞</div>
                    <div class="btn" :class="{ collectSelected: true }">
                        <i class="iconfont icon-shoucang"></i>收藏
                    </div>
                    <div class="share">
                        <div>
                            <i class="iconfont icon-qq"></i>
                            <i class="iconfont icon-weixin"></i>
                            <i class="iconfont icon-weibo"></i>
                            <i class="iconfont icon-twitter"></i>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<style lang="scss" scoped>
:deep(.el-breadcrumb__item .el-breadcrumb__inner) {
    color: #ccc;

    &:hover {
        color: #ccc;
    }
}


.preview-main {
    width: 100%;
    display: block;

    .main-left {
        width: 100%;

        .left-bread {
            width: 100%;
            background-color: white;
            box-sizing: border-box;
            padding: 15px 20px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            border-radius: 10px;
            justify-content: space-between;



            .bread-link {
                margin-left: 10px;
                font-size: 13px;
                color: #ccc;
                display: flex;
                align-items: center;


            }
        }

        .left-main {
            width: 100%;
            background-color: white;
            box-sizing: border-box;
            padding: 30px 20px;
            overflow: hidden;

            .left-title {
                font-size: 16px;
                font-weight: 600;
                font-family: "微软雅黑";

            }

            .left-author {
                display: flex;
                width: 100%;
                justify-content: space-between;
                margin-top: 20px;
                font-size: 13px;
                color: #aaa;
            }

            .left-intro {
                margin: 20px 0;
                background-color: #eee;
                box-sizing: border-box;
                padding: 10px 15px;
                border-radius: 10px;
                color: #999999;
                line-height: 20px;
            }

            .left-photos {
                // height: 100%;
                text-align: center;

                img {
                    height: 100%;
                }
            }

            .left-content {
                margin-top: 20px;
                line-height: 25px;
                font-size: 12px;
            }

            .left-btns {
                margin-top: 40px;
                display: flex;


                .collectSelected {
                    background-color: #fddf8e20;
                    border: #fddf8e solid 1px !important;
                    color: #fddf8e !important;
                }

                .likeSelected {
                    background-color: #fd8ead38;
                    color: #fd8ead !important;
                    border: #fd8ead solid 1px !important;
                }

                .btn {
                    width: 80px;
                    height: 30px;
                    line-height: 30px;
                    border: #ccc solid 1px;
                    margin: 0 10px;
                    text-align: center;
                    border-radius: 5px;
                    color: #999999;
                    cursor: pointer;
                    transition: all .25s ease;

                    i {
                        margin-right: 5px;
                        line-height: 30px;
                    }

                    &:nth-child(1):hover {
                        color: #fd8ead;
                        border: #fd8ead solid 1px;
                    }

                    &:nth-child(2):hover {
                        color: #fddf8e;
                        border: #fddf8e solid 1px;
                    }
                }

                .share {
                    flex: 1;
                    display: flex;
                    justify-content: flex-end;
                    height: 30px;

                    >div {
                        height: 100%;
                        line-height: 30px;

                        i {
                            margin: 0 10px;
                        }
                    }
                }
            }
        }

        .left-review {
            margin-top: 20px;
            width: 100%;
            background-color: white;
            box-sizing: border-box;
            padding: 20px 15px;

            .review-title {
                font-size: 18px;
                font-weight: 600;
                font-family: "微软雅黑";

            }

            .review-area {
                margin-top: 20px;
            }

            .review-btn {
                margin-top: 10px;
                color: #fddf8e;
            }

            // .review-content {
            //     margin-top: 20px;
            //     width: 100%;

            //     .item {
            //         width: 100%;
            //         border-bottom: #eee solid 1px;
            //         padding-bottom: 30px;

            //         .item-user {
            //             width: 100%;
            //             display: flex;
            //             align-items: center;

            //             .user-img {
            //                 border-radius: 50%;
            //                 overflow: hidden;
            //                 width: 40px;
            //                 height: 40px;

            //                 img {
            //                     width: 100%;
            //                     height: 100%;
            //                 }
            //             }

            //             .user-name {
            //                 width: 80%;
            //                 font-size: 16px;
            //                 margin-left: 20px;
            //             }
            //         }

            //         .item-text {
            //             width: 100%;
            //             margin-top: 20px;
            //             margin-left: 40px;
            //         }

            //         .item-answer {
            //             cursor: pointer;
            //             display: inline-block;
            //             box-sizing: border-box;
            //             padding: 5px 10px;
            //             margin-top: 10px;
            //             background-color: #ddd;
            //         }
            //     }
            // }
        }
    }
}
</style>